Workflow is series of activities that follows execution path.
An Activity is a collection of instructions that can include script, logging, approvals, record processing, timers, wait time, rollback activity etc.
To create a workflow we need to go for workflow editor and we can drag and drop required activity in workflow.
We can also drag and drop any other workflow in current workflow.
We can create scratchpad variable to pass values from one activity to another.
If we are using If activity then we can specify condition as follows-
- Following is the main workflow and we have added one sub workflow in main workflow.
- Sub Workflow-
To send data from main workflow to sub workflow we need to create one input variable in sub workflow to hold value coming from main workflow as follows-
We can specify input filed name, type, length etc as follows-
Create scratchpad variable in main workflow
Set value coming from main workflow to input variable Trainer Course
To access value coming in input variable assign it to some other filed like short description
To test this run the catalog item. Add Trainer name as Meghana. then automatically data present is scratchpad variable will be passed to sub workflow. After providing approval, check the workflow. short description should hold data coming from main workflow i.e. Service Now.
To send data back from sub workflow to main workflow we need to create scratchpad variable in sub workflow as follows -
Then need to create return activity as follows and specify scratchpad variable as ${workflow.scratchpad.cost}
Now go to main workflow and set map return value to as follows-
Then assign the value coming from sub workflow to description filed as follows,
Main Workflow-
Sub Workflow -
Result-